﻿using System;
using System.Timers;

namespace CircuitBreaker
{
	public abstract class CircuitBreakerState
	{
		protected readonly CircuitBreaker _circuitBreaker;

		protected CircuitBreakerState(CircuitBreaker circuitBreaker)
		{
			this._circuitBreaker = circuitBreaker;
		}

		public virtual void ProtectedCodeIsAboutToBeCalled() { }
		public virtual void ProtectedCodeHasBeenCalled() { }
		public virtual int ActUponException(Exception e) { return _circuitBreaker.IncreaseFailureCount(); }
	}

	
		
}